package com.example.zsr.akpautoupdatedemo.db;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteDatabase.CursorFactory;
import android.database.sqlite.SQLiteOpenHelper;

public class DBhelper extends SQLiteOpenHelper{

	public static final String DB_NAME = "download.db";
	public static final int VERSION = 1;
	private static final String SQL_CREATE_TABLE = "create table if not exists thread_info(" +
			"_id integer primary key autoincrement," +
			"thread_id integer," +
			"url text," +
			"start integer," +
			"end integer," +
			"finished interger)";
	private static final String SQL_DROP = "drop table if exists thread_info";
	
	public DBhelper(Context context, String name, CursorFactory factory,
			int version) {
		super(context, name, factory, version);
	}

	@Override
	public void onCreate(SQLiteDatabase db) {
		// TODO Auto-generated method stub
		db.execSQL(SQL_CREATE_TABLE);
	}

	@Override
	public void onUpgrade(SQLiteDatabase db, int arg1, int arg2) {
		// TODO Auto-generated method stub
		db.execSQL(SQL_DROP);
		db.execSQL(SQL_CREATE_TABLE);
	}

}
